const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
  // 代理到第一个目标地址
  app.use(
    '/aliyuncs',
    createProxyMiddleware({
      target: 'https://dashscope.aliyuncs.com',
      changeOrigin: true,
      pathRewrite: {
        '^/aliyuncs': '', // 去掉 /aliyuncs 前缀
      },
    })
  );
};